#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N=2e5+10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
int n,m;
string s;
void solve()
{
	cin>>n>>m;
	s.clear();
	cin>>s;
	s='?'+s;
	s+="?????????";
	
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		if(s[i]=='a'&&s[i+1]=='b'&&s[i+2]=='c') cnt++;
	}
	
	while(m--)
	{
		int p;
		char c;
		cin>>p>>c;
		for(int i=p-2;i<=p;i++)
		{
			if(s[i]=='a'&&s[i+1]=='b'&&s[i+2]=='c') cnt--;
		}
		s[p]=c;
		for(int i=p-2;i<=p;i++)
		{
			if(s[i]=='a'&&s[i+1]=='b'&&s[i+2]=='c') cnt++;
		}
		
		cout<<cnt<<'\n';
	}
	
	


}

int main()
{
	close();
	int T=1; //cin>>T;
	while (T--) solve();
	return 0;
}

